home *** CD-ROM | disk | FTP | other *** search
- #include "Danger.h"
-
- // Turning off the following two defines is the only bit of this
- // code that's changed since 1989...
- //#define TRUE 1
- //#define FALSE 0
- #define NIL 0
-
- #define I_Don_t_Bother 1
- #define I_Try_Anyway 2
- #define I_x 3
-
-
- int A_Danger()
- {
- AlertTHndl AlertResHandle;
- Rect tempRect;
- short itemHit;
-
- AlertResHandle = (AlertTHndl)GetResource('ALRT', 5);
- HLock((Handle)AlertResHandle);
-
- /* Get the Alert's box... */
- tempRect.left = (*AlertResHandle)->boundsRect.left;
- tempRect.right = (*AlertResHandle)->boundsRect.right;
- tempRect.top = (*AlertResHandle)->boundsRect.top;
- tempRect.bottom = (*AlertResHandle)->boundsRect.bottom;
-
- /* Center it 1/3rd down the screen */
- tempRect.top = ((qd.screenBits.bounds.bottom - qd.screenBits.bounds.top)
- - (tempRect.bottom - tempRect.top)) / 3;
- tempRect.left = ((qd.screenBits.bounds.right - qd.screenBits.bounds.left)
- - (tempRect.right - tempRect.left)) / 2;
- tempRect.bottom = tempRect.top
- + ((*AlertResHandle)->boundsRect.bottom
- - (*AlertResHandle)->boundsRect.top);
- tempRect.right = tempRect.left
- + ((*AlertResHandle)->boundsRect.right
- - (*AlertResHandle)->boundsRect.left);
-
- /* And set it to be in the right place */
- (*AlertResHandle)->boundsRect.left = tempRect.left;
- (*AlertResHandle)->boundsRect.right = tempRect.right;
- (*AlertResHandle)->boundsRect.top = tempRect.top;
- (*AlertResHandle)->boundsRect.bottom = tempRect.bottom;
-
- /* Let the OS handle the Alert and wait for a result to be returned */
- itemHit = StopAlert(5, NIL);
- HUnlock((Handle)AlertResHandle);
-
- /* Decide which button got pressed and return the appropriate message. */
- if (I_Don_t_Bother == itemHit) return(FALSE);
- if (I_Try_Anyway == itemHit) return(TRUE);
- }
-
-